<%--
  Created by IntelliJ IDEA.
  User: HUAWEI
  Date: 2023/11/2
  Time: 11:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="Utils.StringUtils" %>
<%--生成验证码--%>
<%--<%
    // 1.生成验证码
    String code = StringUtils.getCode(3);

    // 2.将验证码存入session中
    session.setAttribute("code", code);

    // 3.发送给浏览器
%>--%>

<html>
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
    <%--    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js"></script>--%>
    <%--    <script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>--%>

    <script src="../js/jquery.min.js"></script>
    <style>
        .ful {
            height: 577px;
            text-align: center;
            background: url(${pageContext.request.contextPath}/images/LoginBG2.png) no-repeat 6%;
            position: relative;
            width: 1000px;
            margin: 0 auto;
        }

        .ool {
            padding-top: 40px;
            margin-bottom: 30px;
            height: 577px;
            background: url(${pageContext.request.contextPath}/images/LoginBG1.jpg) no-repeat 50%;
            background-size: cover;
        }
    </style>
</head>
<body>

<div class=".container-fluid">
    <div class="p mb-2 bg-danger text-white">
        <div class="nav justify-content-center">
            <div class="container">
                <div class="row">
                    <div class="col">
                        <div class="nav-item">
                            <a class="navbar-brand" href="http://localhost:8080/javaweb/"
                               style="font-family: 仿宋;font-size: 30px;color: white;">新闻网</a>
                        </div>
                    </div>

                    <div class="col-2">
                        <div class="nav-item">
                            <a class="nav-link" href="#" style="font-size: 20px;color: white;">注 册</a>
                        </div>
                    </div>
                    <div class="col"></div>
                </div>
            </div>
        </div>
    </div>

    <div class="ool">
        <div class="ful">
            <div class="container">
                <div class="row">
                    <div class="col-7"></div>
                    <div class="col-5">
                        <div class="shadow p-3 mb-5 bg-white rounded" style="height: 630px;margin-top: -70px">
                            <h3 style="color: red">用 户 注 册</h3>
                            <form method="post" action="register">
                                <div class="form-group">
                                    <label for="User" style="float: left">用户名</label><label
                                        style="color:red;float: left">*</label>
                                    <input type="text" class="form-control" id="User" name="user"
                                           value="${not empty register_req_user?register_req_user:""}">
                                    <span style="color: red;">${register_user_info}</span><br/>

                                    <label for="password" style="float: left">密码</label><label
                                        style="color:red;float: left">*</label>
                                    <input type="text" class="form-control" id="password" name="pwd1"
                                           value="${not empty register_req_pwd1?register_req_pwd1:""}">
                                    <span style="color: red;">${register_pwd1_info}</span><br/>

                                    <label for="password1" style="float: left">确认密码</label><label
                                        style="color:red;float: left">*</label>
                                    <input type="text" class="form-control" id="password1" name="pwd2"
                                           value="${not empty register_req_pwd2?register_req_pwd2:""}">
                                    <span style="color: red;">${register_pwd2_info}</span><br/>

                                    <label for="tel" style="float: left">电话号码</label><label
                                        style="color:red;float:left;">*</label>
                                    <input type="text" class="form-control" id="tel" name="tel"
                                           value="${not empty register_req_tel?register_req_tel:""}">
                                    <span style="color: red;">${register_tel_info}</span><br/>

                                    <div style="float: left">
                                        <label for="code" style="float: left">验证码</label><label
                                            style="color:red;float: left">*</label><br/>
                                        <input type="text" class="form-control" id="code" style="width: 250px"
                                               name="code" value="${not empty register_req_code?register_req_code:""}">
                                        <span style="color: red;">${register_code_info}</span>
                                    </div>

                                    <div style="float: right;margin-top: 35px">
                                        <label id="label_code"><img src="${pageContext.request.contextPath}/code"
                                                                    id="sr" alt="加载中..."></label>
                                    </div>
                                </div>
                                    <div style="margin-top: 100px">
                                        <span style="color: red;margin-top: 20px">${register_from_info}</span>
                                        <input type="submit" class="btn btn-primary btn-lg btn-block" value="注 册">
                                    </div>
                                <div>
                                    已有帐号？
                                    <a href="login.jsp">立即登录</a>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="../ind/footer.jsp" %>
</body>
</html>

<script>
    document.getElementById("label_code").onclick = function () {
        let img = document.getElementById("sr");
        img.src = "${pageContext.request.contextPath}/code?a=" + Math.random();
    }
</script>
